package net.com.sunkey.messagehandler;

import java.nio.ByteBuffer;

import net.com.sunkey.protobuf.Protocol;
import net.com.sunkey.serverlogic.Zone;

/**
 * @author kohachiro
 *
 */
public class GetZoneInfoRequestHandler {
	/**
	 * 
	 */
	public static int invoke(Object data, Object channel) throws Exception {
		System.out.println("["+channel.hashCode()+"]["+Protocol.MessageHandler.GetZoneInfoRequest_VALUE+"]GetZoneInfoRequest");
		int zoneId = ((ByteBuffer) data).getInt();	
		Zone zone=Zone.get(zoneId);	
		if (zone==null)
			return ServerErrorResponseHandler.invoke(Protocol.ReturnStatus.STATUS_ZONE_NOT_FOUND_VALUE, channel);
		GetZoneInfoResponesHandler.invoke(zone,channel);
		return Protocol.MessageHandler.GetZoneInfoRequest_VALUE;

	}

}
